function Web(option, cells){
  BgSprite.apply(this, arguments);
  this.index = option.index || 0;
  this.cells = cells;
  this.change=0;
  this.scale = 0.5;
  this.tX=option.tx;
  this.tY=option.ty;
  this.rotate=option.rotate;
}
Web.prototype={
	draw:function(obj){
    ctx.save();
    ctx.translate(this.tX,this.tY);
    ctx.scale(this.scale,this.scale);
    ctx.rotate(this.rotate);
		ctx.drawImage(this.img, this.cells[this.index].x, this.cells[this.index].y, this.cells[this.index].w, this.cells[this.index].h, this.Cx/this.scale-this.cells[this.index].w/2, this.Cy/this.scale-this.cells[this.index].h/2, this.cells[this.index].w, this.cells[this.index].h);
	  ctx.restore();
  },
  update:function(){
    if (this.change%10==0) {
     this.scale+=0.1;
    }
    this.change++;
  }
}
  function createWeb(obj){
  var cells=[{
    x: 0,
    y: 0,
    w: 242,
    h: 244
    },{
    x: 0,
    y: 0,
    w: 116,
    h: 118
    },{
    x: 0,
    y: 0,
    w: 137,
    h: 142
    },{
    x: 0,
    y: 0,
    w: 156,
    h: 162
    },{
    x: 0,
    y: 0,
    w: 180,
    h: 174
    },{
    x: 0,
    y: 0,
    w: 163,
    h: 155
    },{
    x: 0,
    y: 0,
    w: 191,
    h: 181
    }];
  var web = new Web({
    tx:obj.x,
    ty:obj.y,
    index:obj.url,
    Cx:obj.Cx,
    rotate:obj.rotate,
    url: "img/web"+obj.url+".png"
  },cells);
  return web;
  }



